<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<nav class="navbar-default navbar-static-side" role="navigation" th:fragment="lefter(sysUser,sysRole)">
    <div class="nav-close"><i class="fa fa-times-circle"></i>
    </div>
    <div class="sidebar-collapse">
        <ul class="nav" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element">
                    <span><img alt="image" class="img-circle" width="64px" height="64px"
                               th:src="${sysUser.headimgurl}" onerror="this.src='/img/photo_account_head_default.png'"/></span>
                    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                        <span class="clear">
                            <span class="block m-t-xs"><strong class="font-bold" th:text="${sysUser.nickname}"></strong></span>
                            <span class="text-muted text-xs block" th:text="${sysRole.name}"><b
                                    class="caret"></b></span>
                        </span>
                    </a>
                    <ul class="dropdown-menu animated fadeInRight m-t-xs">
                        <li> <a th:onclick="editUser([[${sysUser.id}]])" class="J_menuItem modal-trigger" data-toggle="modal" data-target="#addUser">修改密码</a>
                        </li>

                        <li class="divider"></li>
                        <li><a href="/logout">安全退出</a>
                        </li>
                    </ul>
                </div>
            </li>

            <li shiro:hasPermission="member_menu">
                <a href="#">
                    <i class="fa fa-users"></i>
                    <span class="nav-label">会员管理</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li shiro:hasPermission="member_list">
                        <a class="J_menuItem" href="/user/list">会员列表</a>
                    </li>
                    <li shiro:hasPermission="user_level_list">
                        <a class="J_menuItem" href="/user_level/list">会员等级列表</a>
                    </li>
                    <li shiro:hasPermission="integral_rule_list">
                        <a class="J_menuItem" href="/integral_rule/list">积分规则</a>
                    </li>
                    <li shiro:hasPermission="marking_rule_list">
                        <a class="J_menuItem" href="/marking_rule/list">新会员注册规则</a>
                    </li>
                    <li shiro:hasPermission="consumption_quota_list">
                        <a class="J_menuItem" href="/consumption_quota/list">满额规则设置</a>
                    </li>
                    <li shiro:hasPermission="user_group_list">
                        <a class="J_menuItem" href="/user_group/list">会员分组</a>
                    </li>
                    <li shiro:hasPermission="iamge_list">
                    <li shiro:hasPermission="user_signIn_list">
                        <a class="J_menuItem" href="/user/signIn/list">查看签到</a>
                    </li>
                    <li shiro:hasPermission="image_list">
                        <a class="J_menuItem" href="/image/list">会员权益</a>
                    </li>

                </ul>
            </li>
            <li shiro:hasPermission="market_menu">
                <a href="#">
                    <i class="fa fa-database"></i>
                    <span class="nav-label">自动化数据</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li shiro:hasPermission="user_rule">
                        <a class="J_menuItem" href="/userLabel/list">用户规则</a>
                    </li>
                </ul>
            </li>
            <li shiro:hasPermission="cent_menu">
                <a href="#">
                    <i class="fa fa-bank"></i>
                    <span class="nav-label">积分管理</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li shiro:hasPermission="cent_sgin_in_rule">
                        <a class="J_menuItem" href="/sign_in_rule/list">签到积分规则</a>
                    </li>
                    <li shiro:hasPermission="cent_list">
                        <a class="J_menuItem" href="/integral/list">会员积分管理</a>
                    </li>
                    <li shiro:hasPermission="cent_self_help">
                        <a class="J_menuItem" href="/self_help_integral/list">自助积分管理</a>
                    </li>
                    <li shiro:hasPermission="cent_self_help_success">
                        <a class="J_menuItem" href="/self_help_integral/check_success_list">拍照上传积分审核通过记录</a>
                    </li>
                    <li shiro:hasPermission="consumption_amount_list">
                        <a class="J_menuItem" href="/consumption_amount/list">会员消费数据列表</a>
                    </li>
                    <li shiro:hasPermission="cent_self_help_check">
                        <a class="J_menuItem" href="/self_help_integral/check_list_jf">拍照上传积分</a>
                    </li>
                    <li shiro:hasPermission="cent_self_help_review_result">
                        <a class="J_menuItem" href="/self_help_integral/review_result_list">小票审核不通过记录</a>
                    </li>
                    <li shiro:hasPermission="abnormal_consumption_list">
                        <a class="J_menuItem" href="/abnormal_consumption/list">积分异常管理</a>
                    </li>
                </ul>
            </li>
            <li shiro:hasPermission="active_menu">
                <a href="#">
                    <i class="fa fa-paper-plane"></i>
                    <span class="nav-label">活动管理</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li shiro:hasPermission="active_list">
                        <a class="J_menuItem" href="/activity/list">活动概况</a>
                    </li>
                    <!--<li>-->
                    <!--<a class="J_menuItem" href="index_v2.html">主题活动</a>-->
                    <!--</li>-->
                    <!--<li>-->
                    <!--<a class="J_menuItem" href="index_v2.html">舞台活动</a>-->
                    <!--</li>-->
                    <!--<li>-->
                    <!--<a class="J_menuItem" href="index_v2.html">商户活动</a>-->
                    <!--</li>-->
                </ul>

            </li>

            <li shiro:hasPermission="ticket_menu">
                <a href="#">
                    <i class="fa fa-ticket"></i>
                    <span class="nav-label">优惠券管理</span>
                    <span class="fa arrow"></span>
                </a>

                <ul class="nav nav-second-level">
                    <li shiro:hasPermission="ticket_coupon_list">
                        <a class="J_menuItem" href="/coupon/list">优惠券管理</a>
                    </li>
                    <li shiro:hasPermission="shopping_kill_list">
                        <a class="J_menuItem" href="/shopping_kill/list">秒杀商品管理</a>
                    </li>
                    <li shiro:hasPermission="group_by_list">
                        <a class="J_menuItem" href="/group_buy/list">团购商品管理</a>
                    </li>
                    <li shiro:hasPermission="shop_mall_list">
                        <a class="J_menuItem" href="/shop_mall/list">商城商品管理</a>
                    </li>
                    <li shiro:hasPermission="coupon_send_record">
                        <a class="J_menuItem" href="/coupon/send/record">优惠券发放记录</a>
                    </li>
                    <li shiro:hasPermission="ticket_coupon_use_record">
                        <a class="J_menuItem" href="/coupon/list/record">优惠券核销记录</a>
                    </li>
                    <li shiro:hasPermission="parking_list">
                        <a class="J_menuItem" href="/parking/list">停车券使用记录</a>
                    </li>
                    <li shiro:hasPermission="parking_parking_record">
                        <a class="J_menuItem" href="/ketop_parking/parking_record">停车缴费记录</a>
                    </li>
                    <li shiro:hasPermission="user_discount_list">
                        <a class="J_menuItem" href="/user_discount/list">停车会员优免</a>
                    </li>
                    <li shiro:hasPermission="square_list">
                        <a class="J_menuItem" href="/square/list">商城兑换次数限制</a>
                    </li>
                    <!--<li>-->
                    <!--<a class="J_menuItem" href="/send_coupon_record/list">查看发券记录</a>-->
                    <!--</li>-->
                    <li shiro:hasPermission="order_list">
                        <a class="J_menuItem" href="/order/list">查看售卖情况</a>
                    </li>
                </ul>
            </li>

            </li>
            <li shiro:hasPermission="banner_menu">
                <a href="#">
                    <i class="fa fa-book"></i>
                    <span class="nav-label">广告管理</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li shiro:hasPermission="banner_list">
                        <a class="J_menuItem" href="/banner/list">广告列表</a>
                    </li>
                </ul>

            </li>

            <li shiro:hasPermission="notice_menu">
                <a href="#">
                    <i class="fa fa-book"></i>
                    <span class="nav-label">公告管理</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li shiro:hasPermission="notice_list">
                        <a class="J_menuItem" href="/notice/list">公告列表</a>
                    </li>
                </ul>

            </li>

            <li shiro:hasPermission="store_menu">
                <a href="#">
                    <i class="fa fa-cube"></i>
                    <span class="nav-label">商铺管理</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li shiro:hasPermission="store_list">
                        <a class="J_menuItem" href="/store/list">商铺管理</a>
                    </li>
                    <li shiro:hasPermission="store_floor_list">
                        <a class="J_menuItem" href="/floor/list">楼层管理</a>
                    </li>
                    <li shiro:hasPermission="report_list">
                        <a class="J_menuItem" href="/report/list">日常消费管理</a>
                    </li>
                    <li shiro:hasPermission="store_category_list">
                        <a class="J_menuItem" href="/commercial/list">业态管理</a>
                    </li>
                    <li shiro:hasPermission="label_list">
                        <a class="J_menuItem" href="/label/list">标签管理</a>
                    </li>
                </ul>

            </li>
            <li shiro:hasPermission="marking_menu">
            <!--<li >-->
                <a href="#">
                    <i class="fa fa-cube"></i>
                    <span class="nav-label">营销活动</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li shiro:hasPermission="marketActivity_scratchCard_list">
                        <a class="J_menuItem" href="/marketActivity/scratchCard/list">刮刮卡</a>
                    </li>
                    <li shiro:hasPermission="turnTable">
                        <a class="J_menuItem" href="/marketActivity/turnTable/list">大转盘</a>
                    </li>
                </ul>

            </li>

            <li>

            <li shiro:hasPermission="admin_menu">
                <a href="#">
                    <i class="fa fa-sitemap"></i>
                    <span class="nav-label">权限管理</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li shiro:hasPermission="admin_list">
                        <a class="J_menuItem" href="/admin/list">核销账号管理</a>
                    </li>
                </ul>
            </li>
            <li shiro:hasPermission="system_menu">
                <a href="#">
                    <i class="fa fa-gear"></i>
                    <span class="nav-label">系统设置</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li>
                        <a href="#">系统管理员<span class="fa arrow"></span></a>
                        <ul class="nav nav-third-level">
                            <li shiro:hasPermission="sys_role_list">
                                <a class="J_menuItem" href="/sys/role/list">系统角色管理</a>
                            </li>
                            <li shiro:hasPermission="sys_user_list">
                                <a class="J_menuItem" href="/sysUser/list">系统用户管理</a>
                            </li>
                            <li shiro:hasPermission="system_log">
                                <a class="J_menuItem" href="/system_log/list">系统日志管理</a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </li>
        </ul>
    </div>

    <!--<a href="http://zhongtai.quanquankeji.cn">
        <img style="position: fixed; left: 32px; bottom: 30px"
             src="http://xiaooo.quanquankeji.cn//data/image/2215620190812.jpg"/>
    </a>-->
    <div class="modal" id="addUser" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width: 400px">
            <div class="modal-content" style="width: 500px">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="userModalLabel">修改密码</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" id="user-form">
                        <div class="form-group" style="display: none;">
                            <label>id</label>
                            <div>
                                <input name="id" class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">账户：</label>
                            <div class="col-sm-8">
                                <input placeholder="请输入账户" name="username" readonly class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">原密码：</label>
                            <div class="col-sm-8">
                                <input placeholder="请输入原密码" type="password" required name="oldPassword" class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">密码：</label>
                            <div class="col-sm-8">
                                <input placeholder="请输入密码" type="password" required name="password" class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">确认密码：</label>
                            <div class="col-sm-8">
                                <input placeholder="请输入确认密码" type="password" required name="confirmPassword" class="form-control">
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="submit-table">提交</button>
                </div>
            </div>
        </div>
    </div>

    <script th:inline="javascript">

        function editUser(id) {
            $('#addUser').modal('show');
            $('.modal-backdrop').css('display','none');
            $.get('/sysUser/get/'+id,function (res) {
                if (res.resCode == 0) {
                    $("#user-form").loadData(res.data);
                }
            });
        }

        $("#submit-table").click(function () {
            let password = $("input[name='password']").val();
            let confirmPassword = $("input[name='confirmPassword']").val();
            if (password != confirmPassword){
                layer.msg("两次密码输入不一致",{icon: 1,time: 1000,shade : [0.5 , '#000' , true]});
                return;
            }
            $.ajax({
                url: '/sysUser/update_password',
                data: $('#user-form').serialize(),
                dataType: 'JSON',
                type: 'POST',
                success: function (res) {
                    let code = res.resCode;
                    if (code == 0) {
                        layer.msg("保存成功",{icon: 1,time: 1000,shade : [0.5 , '#000' , true]});
                        $('#addUser').modal('hide');
                        window.location.href='/logout';
                    } else {
                        layer.msg(res.resMsg,{icon: 2,time: 1000,shade : [0.5 , '#000' , true]});
                    }
                }
            });
        });
    </script>

</nav>
</html>